#pragma once

#include <vector>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <queue>
#include <functional>
#include <atomic>

class ThreadPool
{
private:
    std::vector<std::thread> m_threads;
    std::mutex m_mutex;
    std::condition_variable m_condition_variable;
    std::queue<std::function<void()>> m_queue;
    //todo 这里有问题吗？
    std::atomic<bool> m_stop;
    std::string m_thread_type;

public:
    ThreadPool(int thread_num,const std::string& thread_type);
    void add_task(std::function<void()> fn);
    size_t size();

    void stop();
    ~ThreadPool();
};